package com.trailwalker.mediaplayer;

import com.trailwalker.JavaUtils.log.LogUtils;
import com.trailwalker.javafx.core.activity.Activity;
import com.trailwalker.javafx.core.application.JavaFxApplication;
import com.trailwalker.mediaplayer.activity.MainActivity;
import com.trailwalker.mediaplayer.service.data.MediaPlayerDataService;

/**
 * @author Trailwalker
 * @create 2021-08-31 11:18
 * @des
 */
public class MediaPlayerApplication extends JavaFxApplication {

    private static final String TAG = MediaPlayerApplication.class.getSimpleName();

    private MediaPlayerDataService mediaPlayerDataService;

    /**
     * main线程
     *
     * @param args
     */
    public static void main(String[] args) {
        LogUtils.log(TAG, "application main work at Thread:" + Thread.currentThread().getName());
        launch(args);
    }

    public MediaPlayerDataService getMediaPlayerDataService() {
        return mediaPlayerDataService;
    }

    @Override
    public void onApplicationInit() {
        mediaPlayerDataService = new MediaPlayerDataService();
        mediaPlayerDataService.createTable();
    }

    @Override
    public void onApplicationStart() {

    }

    @Override
    public void onApplicationStop() {
        if (mediaPlayerDataService != null) {
            mediaPlayerDataService.release();
        }
    }

    @Override
    public Class<? extends Activity> initMainActivity() {
        return MainActivity.class;
    }

}
